#include<stdio.h>
#include<dirent.h>
#include<string.h>
void list_dir_name(char *name){
    
    
    if(strlen(name) == 0){
            
        return;
    }

    struct dirent * dir;
    DIR *dp;

    if((dp = opendir(name)) == NULL){
        
       perror("opendir error");
    }

    while((dir = readdir(dp)) != NULL){
    
        printf("%s\n",dir->d_name);
    }
    
}

int main(int argc, char *argv[]){
   
    if(argc != 2){
        
        printf("输入格式错误! 正确格式: list_dir_name ./");
    }    
 
   list_dir_name(argv[1]); 

   return 0;
}


